﻿#include <stdio.h>
#include <stdlib.h>
#include "deal.h"
#include "gitfunc.h"

int main(int argc, char* argv[])
{
	Git git=unknown;  //初始化git
	cmdl* c;  //定义cmdl函数结构体指针
	int spacenum;
	char index[5][40]={"\0","\0","\0","\0","\0"};
	char options[5][20]={"\0","\0","\0","\0","\0"};
	char command[40]="\0";
	system("chcp 65001 & cls"); 
	c->add_action=add_action;  //指针指向对应函数
	c->add_option=add_option;
	while(1)
	{
		printf("$ ");
		index_get(index);
		gets(command);
		tick(command,options,&spacenum);
		git=c->add_action(options[1]);
		if(git!=unknown)
		{
			c->add_option(git,options,index);  //使用add_option函数进一步处理命令行
		}
		else printf("unknown action!");
		printf("\n");
		index_writein(index);
	}
	return 0;
}